-
Notifications
You must be signed in to change notification settings - Fork 0
PM-1206 - reset payment status #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
UPDATE payment | ||
SET payment_status = 'ON_HOLD' | ||
WHERE winnings_id IN ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
medium
performance
The subquery in the WHERE
clause could potentially lead to performance issues if the winnings
table is large. Consider using an EXISTS
clause instead of IN
to improve performance by stopping at the first match.
FROM winnings | ||
LEFT JOIN trolley_recipient ON winnings.winner_id = trolley_recipient.user_id | ||
LEFT JOIN trolley_recipient_payment_method ON trolley_recipient.id = trolley_recipient_payment_method.trolley_recipient_id | ||
WHERE payment.payment_status = 'OWED' AND ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
high
correctness
Ensure that the payment
table is correctly joined with the winnings
table. The current query assumes that winnings_id
in the payment
table directly corresponds to winning_id
in the winnings
table, which might not be the case if there are any discrepancies or missing foreign key constraints.
LEFT JOIN trolley_recipient ON winnings.winner_id = trolley_recipient.user_id | ||
LEFT JOIN trolley_recipient_payment_method ON trolley_recipient.id = trolley_recipient_payment_method.trolley_recipient_id | ||
WHERE payment.payment_status = 'OWED' AND ( | ||
trolley_recipient.trolley_id IS NULL OR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please remove this?
Sorry, had to mention this in AC, but realized we could have trolley_id
records pre-created for members when we import offline data. So we want to target members without trolley_recipient_payment_method
set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cleared in Slack.
LEFT JOIN trolley_recipient ON winnings.winner_id = trolley_recipient.user_id | ||
LEFT JOIN trolley_recipient_payment_method ON trolley_recipient.id = trolley_recipient_payment_method.trolley_recipient_id | ||
WHERE payment.payment_status = 'OWED' AND ( | ||
trolley_recipient.trolley_id IS NULL OR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cleared in Slack.
https://topcoder.atlassian.net/browse/PM-1206 - Reset payment status for Owed/Available payments